package com.ruoyi.edu.service.impl;

import com.ruoyi.edu.domain.vo.CoursePublishVo;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.ruoyi.edu.mapper.EduCourseMapper;
import com.ruoyi.edu.domain.EduCourse;
import com.ruoyi.edu.service.IEduCourseService;

import java.util.List;
import java.util.Map;

/**
 * 课程Service业务层处理
 *
 * @author niruichen
 * @date 2020-12-22
 */
@Service
public class EduCourseServiceImpl extends ServiceImpl<EduCourseMapper, EduCourse> implements IEduCourseService {

    @Override
    public List<EduCourse> queryList(EduCourse eduCourse) {
        LambdaQueryWrapper<EduCourse> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(eduCourse.getTitle())){
            lqw.eq(EduCourse::getTitle ,eduCourse.getTitle());
        }
        if (StringUtils.isNotBlank(eduCourse.getStatus())){
            lqw.eq(EduCourse::getStatus ,eduCourse.getStatus());
        }
        return this.list(lqw);
    }

    //查询课程确认信息
    @Override
    public CoursePublishVo publishCourseInfo(String id) {
        //调用mapper
        CoursePublishVo publishCourseInfo = baseMapper.getPublishCourseInfo(id);
        return publishCourseInfo;
    }
}
